Conversation
|
Title got mixed up. This is for the chatmail prober, which is almost ready. |
- Add CMPingError exception for non-fatal error reporting - Add set_cli_output() to let library callers suppress terminal output - Convert sys.exit(1) to raise CMPingError in setup_accounts, wait_profiles_online, and wait_profiles_online_multi - Add accounts_dir parameter to perform_ping() for concurrent probe isolation (each caller can use its own DB directory) - Wrap perform_ping() in main() with try/except CMPingError
- Add logging module with log = getLogger("cmping")
- Convert all print() calls to log.debug/info/warning/error
- Add logging.basicConfig() in main() keyed to verbose level
- Change print_progress() to write to stderr with _cli_output guard
- Gate per-message RTT lines and statistics on _cli_output flag
- Replace Unicode spinner chars with ASCII for portability
46ffa78 to
91e49c9
Compare
| import argparse | ||
| import contextlib | ||
| import ipaddress | ||
| import logging |
There was a problem hiding this comment.
I think @hpk42 is not fun of this logging crate, I also don't like what it does in deltachat-rpc-client even though we use it and it is enabled at
https://github.com/chatmail/core/blob/aedc60f1ccb4f9898123d150662c058ac14ff61f/deltachat-rpc-client/tox.ini#L29-L30
It is surprising for users because output is in a different place from pytest runs that don't use it, it is not obvious where it is enabled (i looked into pyproject.toml before looking into tox.ini) etc.
|
Somewhat high-level comment: for https://github.com/j4n/chatmail-prober maybe it makes sense to "vendor" cmping into chatmail_prober/prober.py, remove all the prints and hardcode accounts directory and remove group pinging? There is not much code that is actually used and not having to monkeypatch print or using |
|
|
||
| # Spinner characters for progress display | ||
| SPINNER_CHARS = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] | ||
| SPINNER_CHARS = ["|", "/", "-", "\\"] |
There was a problem hiding this comment.
Replace Unicode spinner chars with ASCII for portability
Reminds me of the days when I installed FreeBSD which back then did not support UTF-8. I think practically any system supports unicode now.
|
I agree, this is venturing far beyond the original scope and it makes more sense to interface with the RPC server directly. I have "vendored" the direct mode ping etc. into the prober, and indeed it become much easier / faster, so closing these PRs as obsolete. |
Two commits to make cmping importable as a library:
Error Handling & Isolation
Logging